<div id="sign" class="sign">
    <div class="part loginPart">
        <form id="login"  novalidate="novalidate">
            <h3>登录<p class="status"></p></h3>
            <p> <label class="icon" for="username"><i class="fa fa-user"></i></label> <input class="input-control" id="user_name" type="text" placeholder="请输入用户名" name="user_name" required="" aria-required="true" /> </p>
            <p> <label class="icon" for="password"><i class="fa fa-lock"></i></label> <input class="input-control" id="user_pass" type="password" placeholder="请输入密码" name="user_pass" required="" aria-required="true" /> </p>
            <p class="safe"> <label class="remembermetext" for="rememberme"><input name="rememberme" type="checkbox" checked="checked" id="rememberme" class="rememberme" value="forever" />记住我的登录</label> <a class="lost" href="https://www.lmonkey.com/wp-login.php?action=lostpassword">忘记密码 ?</a> </p>
            <p> <input class="submit" type="button" onclick="dologin()" value="登录" name="submit" /> </p>
            <a class="close"><i class="fa fa-times"></i></a>
            <input type="hidden" id="security" name="security" value="0a0415938b" />
            <input type="hidden" name="_wp_http_referer" value="/" />
        </form>
    </div>
    <div class="part registerPart">
        <form id="register"  method="post" novalidate="novalidate">
            <div id="login-active" class="switch">
                <i class="fa fa-toggle-off"></i>切换登录
            </div>
            <h3>注册<p class="status"></p></h3>
            <p> <label class="icon" for="user_name"><i class="fa fa-user"></i></label> <input class="input-control" id="user_name" type="text" name="user_name" placeholder="输入英文用户名" required="" aria-required="true" /> </p>
            <p> <label class="icon" for="user_email"><i class="fa fa-envelope"></i></label> <input class="input-control" id="user_email" type="email" name="user_email" placeholder="输入常用邮箱" required="" aria-required="true" /> </p>
            <p> <label class="icon" for="user_pass"><i class="fa fa-lock"></i></label> <input class="input-control" id="user_pass" type="password" name="user_pass" placeholder="密码最小长度为6" required="" aria-required="true" /> </p>
            <p> <label class="icon" for="user_pass2"><i class="fa fa-retweet"></i></label> <input class="input-control" type="password" id="user_pass2" name="user_pass2" placeholder="再次输入密码" required="" aria-required="true" /> </p>
            <p> <input class="submit"  type="button" value="注册" name="submit" onclick="dologin()" /> </p>
            <a class="close"><i class="fa fa-times"></i></a>
            <input type="hidden" id="user_security" name="user_security" value="a2adda87ef" />
            <input type="hidden" name="_wp_http_referer" value="/" />
        </form>
    </div>
</div>
@include('admin.public.script')
<script>

    function dologin()
    {

        var phone = $('#user_name').val();

        var user_pass = $('#user_pass').val();

        if(phone.length == 0){
            layer.msg('请输入账号',{icon:5,time:1000});
            return;
        }

        if(user_pass.length < 6){
            layer.msg('密码最少6位',{icon:5,time:1000});
            return;
        }

        $.ajax({
            'url' : '/index/dologin',
            'type': 'POST',
            'data': {'user_name':phone,'user_pass':user_pass},
            'headers': {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            },
            'dataType': 'json',
            success : function(data){
                if(data.status == 0){
                    layer.msg(data.message,{icon:6,time:1000})
                    location.reload();
                }else{
                    layer.msg(data.message,{icon:6,time:1000})

                }
            },
            error : function(){
                layer.msg('登录失败',{icon:5,time:500})
            }
        })
    }
</script>